package com.nulldev.util.threading.event;

public class GeneralEventProducer {
	private EventQueue eventQueue;
	
	public EventQueue getEventQueue() {
		return eventQueue;
	}
	
	public void setEventQueue(EventQueue queue) {
		if (this.eventQueue != null)
			throw new RuntimeException("An event queue already bound to this object.");
		this.eventQueue = queue;
	}
	
	public void removeEventQueue() {
		eventQueue = null;
	}
	
	public boolean postEvent(Event event) {
		if (eventQueue == null)
			return false;
		
		eventQueue.post(event);
		return true;
	}
}
